const initState = {
	user: {
		username: '',
		token: '',
		tel: '',
		url: '',
		isLogin: false,
		...JSON.parse(localStorage.getItem('user') || "{}") 
	}
}

const reducer = (state = initState, action: any) => {
	switch(action.type) {
		case 'SET_USER': 
			return {
				...state,
				user: {
					...state.user,
					...action.payload
				}
			}
		default: 
			return {
				...state
			}
	}
}


export default reducer